package com.credithc.eagleeye.plugins.feign;
import feign.Client;
import feign.Request;
import feign.Response;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory;
import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;

import java.io.IOException;
/**
 * 描 述: <br/>
 * 作 者: zhangjin<br/>
 * 创 建：2019年11月04日<br/>
 * 版 本：v1.0.0<br>
 * <p>
 * 历 史: (版本) 作者 时间 注释 <br/>
 */
@Slf4j
public class EagleEyeLoadBalancerFeignClient extends LoadBalancerFeignClient {
    public EagleEyeLoadBalancerFeignClient(Client delegate, CachingSpringLoadBalancerFactory lbClientFactory,
                                           SpringClientFactory clientFactory) {
        super(delegate, lbClientFactory, clientFactory);
    }

    @Override
    public Response execute(Request request, Request.Options options) throws IOException {
        log.debug("EagleEyeLoadBalancerFeignClient around start...");
        Response response = super.execute(request, options);
        log.debug("EagleEyeLoadBalancerFeignClient around end...");
        return response;
    }
}
